package Vista;
import javax.swing.JTable;

import javax.swing.WindowConstants;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableModel;
import javax.swing.SwingUtilities;

import java.util.*;
import Controlador.*;
import Modelo.ProveedorView;


/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class ListarProveedor extends javax.swing.JFrame {
	private JTable viviendas;

	/**
	* Auto-generated main method to display this JFrame
	*/
	
	public ListarProveedor() {
		super();
		initGUI();
	}
	
	private void initGUI() {
		try {
			setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
			getContentPane().setLayout(null);
			{
				Vector<String> prove = new Vector<String>();
				Vector<Vector> listado = new Vector<Vector>();
				Vector<ProveedorView>vivi = Sistema.getInstancia().listarProveedor();
				
				for (int i=0; i< vivi.size();i++)
				{
					viv = new Vector<String>();
					viv.add(vivi.elementAt(i).getDomicilio());
					viv.add(String.valueOf(vivi.elementAt(i).getValor()));
					listado.add(viv);
				}
				viv = new Vector<String>();
				viv.add("domicilio");
				viv.add("valor");
				TableModel viviendasModel = new DefaultTableModel(listado,viv);
							
				viviendas = new JTable();
				getContentPane().add(viviendas);
				viviendas.setModel(viviendasModel);
				viviendas.setBounds(26, 12, 354, 224);
			}
			pack();
			setSize(400, 300);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

}